package com.gxa.insurance.service.impl;

import com.gxa.insurance.exception.BusinessException;
import com.gxa.insurance.exception.ExceptionCode;
import com.gxa.insurance.mapper.OrderMapper;
import com.gxa.insurance.mapper.OrderStatusMapper;
import com.gxa.insurance.pojo.Order;
import com.gxa.insurance.pojo.OrderStatus;
import com.gxa.insurance.service.OrderService;
import com.gxa.insurance.service.OrderStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @date 2022/6/16
 */
@Service("orderStatuseService")
public class OrderStatuseServiceImpl implements OrderStatusService{

    @Autowired
    OrderStatusMapper orderStatusMapper;

    @Override
    public OrderStatus selectOrderStatus(String orderStatus) throws BusinessException {

        OrderStatus orderStatus1 = orderStatusMapper.selectOrderStatus(orderStatus);

        if (orderStatus1==null){

            throw new BusinessException(ExceptionCode.EMPTY_LIST);
        }

        return orderStatus1;
    }

    @Override
    public void updateStatus(Order order) {

        orderStatusMapper.updateOrderStatus(order);

    }
}
